package _interview100;

/**
 * 153. 寻找旋转排序数组中的最小值
 */
public class No153 {
    public int findMin(int[] nums) {
        int minVal = nums[nums.length - 1];
        int left = 0, right = nums.length - 2;
        while (left <= right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] > minVal) left = mid + 1;
            else {
                minVal = nums[right];
                right = mid - 1;
            }
        }
        return nums[left];
    }
}
